export function price(a) {
  var num = Number(a)
  if (!num) {
    //等于0
    return num + '.00'
  } else {
    //不等于0
    num = Math.round(num * 100) / 10000
    num = num.toFixed(2)
    num += '' //转成字符串
    var reg =
      num.indexOf('.') > -1
        ? /(\d{1,3})(?=(?:\d{3})+\.)/g
        : /(\d{1,3})(?=(?:\d{3})+$)/g //千分符的正则
    console.log(num.indexOf('.') > -1)
    return num.replace(reg, '$1,') //千分位格式化
  }
}
